package pers.corvey.studyjava.model.form;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import pers.corvey.studyjava.model.Test;
import pers.corvey.studyjava.util.ToStringUtils;

public class TestForm implements MyValidatable {

    @NotNull(message="标题不能为空！")
    @Size(max=10, message="标题不能超过10个汉字")
    private String title;
    
    private String description;
    
    public TestForm() {}
    
    public Test toTest() {
        Test test = new Test();
        test.setTitle(getTitle());
        test.setDescription(getDescription());
        return test;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    
    @Override
    public String toString() {
        return ToStringUtils.objectToString(this);
    }
}
